<!DOCTYPE html>
<html lang="zh">
	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>3-5 flex 给子元素设置伸缩比例 </title>
	</head>


	<!--
	 
	3.5  其他属性
	flex-bsis  设置弹性盒子 伸缩基准 
	flex-grow  设置弹性盒子的扩展比率
	flex-shrink  设置弹性盒子的缩小比率 
	

	 -->

	<style>
		* {
			margin: 0;
			padding: 0;
			box-sizing: content-box;
		}

		.container {
			color: red;
			font-size: 25px;
			width: 400px;
			height: 500px;
			
			/* 父元素 flex 布局 */
			display: flex;
			flex-direction: row;
			background-color: pink;
		}

		.container div {
			width: 200px;
			height: 100px;
			background-color: lightyellow;
			/* 相对于父容器的 30% 设置宽度 */
			/* flex-basis: 30%; */
			/* margin-right: 1px; */
		}
		
		
		/* 
		 父容器 400  - 50 -100 = 250px  
		 
		 250/5 = 50
		 
		 400 - 50 - 100 
		 
		 
		 50 + 50*1
		 
		 100 + 50*4
		 */
		div:nth-child(1){
			/* 设置基准值后 ， width 将不在生效了 */
			flex-basis: 50px;
			flex-grow: 1;
			/* background-color: #555; */
		}
		
		div:nth-child(2){
			flex-basis: 100px;
			flex-grow: 4;
			/* background-color: #888; */
		}
		
	/* 	div:nth-child(3){
			flex-basis: 20%;
			background-color: #aaa;
		} */
		div {

		}
	</style>

	<!-- 
	 
	
	 -->

	<body>

		<div class="container">

			<div>1</div>
			<div>2</div>
			<!-- <div>3</div> -->
			<!-- <div>4</div> -->


		</div>

	</body>
</html>
